package com.cee.admin.config.interceptor;

import com.cee.common.core.context.ProgressBarContext;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author wsz
 * @since 2023/11/20
 */
@Slf4j
public class ProgressBarContextInterceptor implements HandlerInterceptor {

    @Override
    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
        try {
            ProgressBarContext.remove();
        } catch (Exception e){
            log.error("移除进度条失败", e);
        }
    }
}
